<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>module Test::Unit::Assertions - test-unit: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="module">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-use_pp-3D">::use_pp=</a>
    <li ><a href="#method-i-_assert_in_delta_message">#_assert_in_delta_message</a>
    <li ><a href="#method-i-_assert_in_delta_validate_arguments">#_assert_in_delta_validate_arguments</a>
    <li ><a href="#method-i-_assert_in_epsilon_message">#_assert_in_epsilon_message</a>
    <li ><a href="#method-i-_assert_in_epsilon_validate_arguments">#_assert_in_epsilon_validate_arguments</a>
    <li ><a href="#method-i-_assert_raise">#_assert_raise</a>
    <li ><a href="#method-i-_set_failed_information">#_set_failed_information</a>
    <li ><a href="#method-i-_wrap_assertion">#_wrap_assertion</a>
    <li ><a href="#method-i-add_assertion">#add_assertion</a>
    <li ><a href="#method-i-assert">#assert</a>
    <li ><a href="#method-i-assert_alias_method">#assert_alias_method</a>
    <li ><a href="#method-i-assert_all">#assert_all</a>
    <li ><a href="#method-i-assert_all-3F">#assert_all?</a>
    <li ><a href="#method-i-assert_block">#assert_block</a>
    <li ><a href="#method-i-assert_boolean">#assert_boolean</a>
    <li ><a href="#method-i-assert_compare">#assert_compare</a>
    <li ><a href="#method-i-assert_const_defined">#assert_const_defined</a>
    <li ><a href="#method-i-assert_empty">#assert_empty</a>
    <li ><a href="#method-i-assert_equal">#assert_equal</a>
    <li ><a href="#method-i-assert_fail_assertion">#assert_fail_assertion</a>
    <li ><a href="#method-i-assert_false">#assert_false</a>
    <li ><a href="#method-i-assert_in_delta">#assert_in_delta</a>
    <li ><a href="#method-i-assert_in_epsilon">#assert_in_epsilon</a>
    <li ><a href="#method-i-assert_include">#assert_include</a>
    <li ><a href="#method-i-assert_includes">#assert_includes</a>
    <li ><a href="#method-i-assert_instance_of">#assert_instance_of</a>
    <li ><a href="#method-i-assert_kind_of">#assert_kind_of</a>
    <li ><a href="#method-i-assert_match">#assert_match</a>
    <li ><a href="#method-i-assert_nil">#assert_nil</a>
    <li ><a href="#method-i-assert_no_match">#assert_no_match</a>
    <li ><a href="#method-i-assert_not_const_defined">#assert_not_const_defined</a>
    <li ><a href="#method-i-assert_not_empty">#assert_not_empty</a>
    <li ><a href="#method-i-assert_not_equal">#assert_not_equal</a>
    <li ><a href="#method-i-assert_not_in_delta">#assert_not_in_delta</a>
    <li ><a href="#method-i-assert_not_in_epsilon">#assert_not_in_epsilon</a>
    <li ><a href="#method-i-assert_not_include">#assert_not_include</a>
    <li ><a href="#method-i-assert_not_includes">#assert_not_includes</a>
    <li ><a href="#method-i-assert_not_instance_of">#assert_not_instance_of</a>
    <li ><a href="#method-i-assert_not_kind_of">#assert_not_kind_of</a>
    <li ><a href="#method-i-assert_not_match">#assert_not_match</a>
    <li ><a href="#method-i-assert_not_nil">#assert_not_nil</a>
    <li ><a href="#method-i-assert_not_operator">#assert_not_operator</a>
    <li ><a href="#method-i-assert_not_predicate">#assert_not_predicate</a>
    <li ><a href="#method-i-assert_not_respond_to">#assert_not_respond_to</a>
    <li ><a href="#method-i-assert_not_same">#assert_not_same</a>
    <li ><a href="#method-i-assert_not_send">#assert_not_send</a>
    <li ><a href="#method-i-assert_nothing_leaked_memory">#assert_nothing_leaked_memory</a>
    <li ><a href="#method-i-assert_nothing_raised">#assert_nothing_raised</a>
    <li ><a href="#method-i-assert_nothing_thrown">#assert_nothing_thrown</a>
    <li ><a href="#method-i-assert_operator">#assert_operator</a>
    <li ><a href="#method-i-assert_path_exist">#assert_path_exist</a>
    <li ><a href="#method-i-assert_path_not_exist">#assert_path_not_exist</a>
    <li ><a href="#method-i-assert_predicate">#assert_predicate</a>
    <li ><a href="#method-i-assert_raise">#assert_raise</a>
    <li ><a href="#method-i-assert_raise_kind_of">#assert_raise_kind_of</a>
    <li ><a href="#method-i-assert_raise_message">#assert_raise_message</a>
    <li ><a href="#method-i-assert_raise_with_message">#assert_raise_with_message</a>
    <li ><a href="#method-i-assert_raises">#assert_raises</a>
    <li ><a href="#method-i-assert_respond_to">#assert_respond_to</a>
    <li ><a href="#method-i-assert_same">#assert_same</a>
    <li ><a href="#method-i-assert_send">#assert_send</a>
    <li ><a href="#method-i-assert_throw">#assert_throw</a>
    <li ><a href="#method-i-assert_throws">#assert_throws</a>
    <li ><a href="#method-i-assert_true">#assert_true</a>
    <li ><a href="#method-i-build_message">#build_message</a>
    <li ><a href="#method-i-flunk">#flunk</a>
    <li ><a href="#method-i-refute">#refute</a>
    <li ><a href="#method-i-refute_empty">#refute_empty</a>
    <li ><a href="#method-i-refute_equal">#refute_equal</a>
    <li ><a href="#method-i-refute_in_delta">#refute_in_delta</a>
    <li ><a href="#method-i-refute_in_epsilon">#refute_in_epsilon</a>
    <li ><a href="#method-i-refute_includes">#refute_includes</a>
    <li ><a href="#method-i-refute_instance_of">#refute_instance_of</a>
    <li ><a href="#method-i-refute_kind_of">#refute_kind_of</a>
    <li ><a href="#method-i-refute_match">#refute_match</a>
    <li ><a href="#method-i-refute_nil">#refute_nil</a>
    <li ><a href="#method-i-refute_operator">#refute_operator</a>
    <li ><a href="#method-i-refute_predicate">#refute_predicate</a>
    <li ><a href="#method-i-refute_respond_to">#refute_respond_to</a>
    <li ><a href="#method-i-refute_same">#refute_same</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="module-Test::Unit::Assertions">
    <h1 id="module-Test::Unit::Assertions" class="module">
      module Test::Unit::Assertions
    </h1>

    <section class="description">
    
<p><a href="Assertions.html"><code>Test::Unit::Assertions</code></a> contains the standard <a href="../Unit.html"><code>Test::Unit</code></a> assertions. <a href="Assertions.html"><code>Assertions</code></a> is included in <a href="TestCase.html"><code>Test::Unit::TestCase</code></a>.</p>

<p>To include it in your own code and use its functionality, you simply need to rescue <a href="AssertionFailedError.html"><code>Test::Unit::AssertionFailedError</code></a>. Additionally you may override <a href="Assertions.html#method-i-add_assertion"><code>add_assertion</code></a> to get notified whenever an assertion is made.</p>

<p>Notes:</p>
<ul><li>
<p>The message to each assertion, if given, will be propagated with the failure.</p>
</li><li>
<p>It is easy to add your own assertions based on <a href="Assertions.html#method-i-assert_block"><code>assert_block</code></a>().</p>
</li></ul>

<p>@example Example Custom Assertion</p>

<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">deny</span>(<span class="ruby-identifier">boolean</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-string">&#39;&lt;?&gt; is not false or nil.&#39;</span>, <span class="ruby-identifier">boolean</span>)
  <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">message</span>) <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">not</span> <span class="ruby-identifier">boolean</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="NOT_SPECIFIED">NOT_SPECIFIED
          <dd><p>@private</p>
        </dl>
        </section>



                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-use_pp-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">use_pp=</span><span
                                class="method-args">(value)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Select whether or not to use the pretty-printer. If this option is set to false before any assertions are made, pp.rb will not be required.</p>

                              <div class="method-source-code" id="use_pp-3D-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1939</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">use_pp=</span>(<span class="ruby-identifier">value</span>)
  <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">use_pp</span> = <span class="ruby-identifier">value</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-add_assertion" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_assertion</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Called whenever an assertion is made. Define this in classes that include <a href="Assertions.html"><code>Test::Unit::Assertions</code></a> to record assertion counts.</p>

<p>This is a public API for developers who extend test-unit.</p>

<p>@return [void]</p>

                              <div class="method-source-code" id="add_assertion-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1933</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_assertion</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert</span><span
                                class="method-args">(object=NOT_SPECIFIED, message=nil) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@overload assert(object, message=nil)</p>

<pre>Asserts that `object` is not false nor nil.

Normally, you don&#39;t need to use this assertion. Use more
specific assertions such as #assert_equal and
#assert_include.

@example Pass patterns
  assert(true)               # =&gt; pass
  assert([1, 2].include?(1)) # =&gt; pass

@example Failure patterns
  assert(nil)                # =&gt; failure
  assert(false)              # =&gt; failure
  assert([1, 2].include?(5)) # =&gt; failure

@param [Object] object The check target.
@param [String] message The additional user message. It is
  showed when the assertion is failed.
@return [void]</pre>

<p>@overload assert(message=nil) {}</p>

<pre>Asserts that the givens block returns not false nor nil.

This style uses Power Assert. It means that you can see each
object values in method chains on failure. See the following
example about Power Assert.

@example Power Assert
  coins = [1, 5, 50]
  target_coin = 10
  assert do
    coins.include?(target_coin)
  end
  # =&gt;
  #  coins.include?(target_coin)
  #  |     |        |
  #  |     |        10
  #  |     false
  #  [1, 5, 50]

We recommend you to use Power Assert for predicate method
checks rather than existing assertions such as
#assert_include and #assert_predicate. Power Assert shows
useful message for debugging.

We don&#39;t recommend you use Power Assert for equality
check. You should use #assert_equal for the case. Because
#assert_equal shows more useful message for debugging.

@example Pass patterns
  assert {true}               # =&gt; pass
  assert {[1, 2].include?(1)} # =&gt; pass

@example Failure patterns
  assert {nil}                # =&gt; failure
  assert {false}              # =&gt; failure
  assert {[1, 2].include?(5)} # =&gt; failure

@param [String] message The additional user message. It is
  showed when the assertion is failed.
@yield [] Given no parameters to the block.
@yieldreturn [Object] The checked object.
@return [void]</pre>

                              <div class="method-source-code" id="assert-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 134</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert</span>(<span class="ruby-identifier">object</span>=<span class="ruby-constant">NOT_SPECIFIED</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">have_object</span> = <span class="ruby-operator">!</span><span class="ruby-constant">NOT_SPECIFIED</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">object</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">block</span>
      <span class="ruby-identifier">message</span> = <span class="ruby-identifier">object</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">have_object</span>
      <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">PowerAssert</span>)
        <span class="ruby-constant">PowerAssert</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">block</span>, <span class="ruby-value">:assertion_method</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">__callee__</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pa</span><span class="ruby-operator">|</span>
          <span class="ruby-identifier">pa_message</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">delayed_literal</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">pa</span>.<span class="ruby-identifier">message_proc</span>)
          <span class="ruby-identifier">assertion_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-string">&quot;?&quot;</span>, <span class="ruby-identifier">pa_message</span>)
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">assertion_message</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-identifier">pa</span>.<span class="ruby-identifier">yield</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">assert</span>(<span class="ruby-keyword">yield</span>, <span class="ruby-identifier">message</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">have_object</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;wrong number of arguments (0 for 1..2)&quot;</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">assertion_message</span> = <span class="ruby-keyword">nil</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">message</span>
      <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>, <span class="ruby-constant">String</span>, <span class="ruby-constant">Proc</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">AssertionMessage</span>
        <span class="ruby-identifier">assertion_message</span> = <span class="ruby-identifier">message</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">error_message</span> = <span class="ruby-string">&quot;assertion message must be String, Proc or &quot;</span>
        <span class="ruby-identifier">error_message</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;#{AssertionMessage}: &quot;</span>
        <span class="ruby-identifier">error_message</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;&lt;#{message.inspect}&gt;(&lt;#{message.class}&gt;)&quot;</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-identifier">error_message</span>, <span class="ruby-identifier">filter_backtrace</span>(<span class="ruby-identifier">caller</span>)
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">assertion_message</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                          <span class="ruby-string">&quot;&lt;?&gt; is not true.&quot;</span>,
                                          <span class="ruby-identifier">object</span>)
      <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">assertion_message</span>) <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">object</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_alias_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_alias_method</span><span
                                class="method-args">(object, alias_name, original_name, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`#`alias_name` is an alias method of `object`#`original_name`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_alias_method</span>([], <span class="ruby-value">:length</span>, <span class="ruby-value">:size</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_alias_method</span>([], <span class="ruby-value">:size</span>, <span class="ruby-value">:length</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_alias_method</span>([], <span class="ruby-value">:each</span>, <span class="ruby-value">:size</span>)    <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_alias_method-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1587</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_alias_method</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">alias_name</span>, <span class="ruby-identifier">original_name</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">find_method_failure_message</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_name</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                    <span class="ruby-string">&quot;&lt;?&gt;.? doesn&#39;t exist\n&quot;</span> <span class="ruby-operator">+</span>
                    <span class="ruby-string">&quot;(Class: &lt;?&gt;)&quot;</span>,
                    <span class="ruby-identifier">object</span>,
                    <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">literal</span>(<span class="ruby-identifier">method_name</span>),
                    <span class="ruby-identifier">object</span>.<span class="ruby-identifier">class</span>)
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">alias_method</span> = <span class="ruby-identifier">original_method</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">find_method_failure_message</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">alias_name</span>)) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">alias_method</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">alias_name</span>)
        <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
        <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">find_method_failure_message</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">original_name</span>)) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">original_method</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">original_name</span>)
        <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
        <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; is alias of\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;&lt;?&gt; expected&quot;</span>,
                                 <span class="ruby-identifier">alias_method</span>,
                                 <span class="ruby-identifier">original_method</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">alias_method</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">original_method</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_all" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_all</span><span
                                class="method-args">(collection, message=nil) { |item| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@overload <a href="Assertions.html#method-i-assert_all"><code>assert_all</code></a>(collection, message=nil, &amp;block)</p>

<pre>Asserts that all `block.call(item)` where `item` is each
item in `collection` are not false nor nil.

If `collection` is empty, this assertion is always passed
with any `block`.

@example Pass patterns
  assert_all([1, 2, 3]) {|item| item &gt; 0} # =&gt; pass
  assert_all([1, 2, 3], &amp;:positive?)      # =&gt; pass
  assert_all([]) {|item| false}           # =&gt; pass

@example Failure pattern
  assert_all([0, 1, 2], &amp;:zero?) # =&gt; failure

@param [#each] collection The check target.
@param [String] message The additional user message. It is
  showed when the assertion is failed.
@yield [Object] Give each item in `collection` to the block.
@yieldreturn [Object] The checked object.
@return [void]</pre>

<p>@since 3.4.4</p>

                              <div class="method-source-code" id="assert_all-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1797</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_all</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-identifier">failed</span> = <span class="ruby-keyword">false</span>
          <span class="ruby-identifier">result</span> = {}
          <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
            <span class="ruby-identifier">element_result</span> = <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">item</span>)
            <span class="ruby-identifier">failed</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">element_result</span>
            <span class="ruby-identifier">result</span>[<span class="ruby-identifier">item</span>] = <span class="ruby-identifier">element_result</span>
          <span class="ruby-keyword">end</span>
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;-FORMAT</span>
<span class="ruby-value">&lt;?&gt; was expected to be all true values with the given block but was
&lt;?&gt;
</span><span class="ruby-identifier">          FORMAT</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                       <span class="ruby-identifier">format</span>,
                                       <span class="ruby-identifier">collection</span>,
                                       <span class="ruby-identifier">result</span>)
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-keyword">not</span> <span class="ruby-identifier">failed</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-assert_all-3F">assert_all?</a>
                            </div>

                          </div>

                  <div id="method-i-assert_all-3F" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">assert_all?</span><span
                                class="method-args">(collection, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for Ruby’s tool/lib/test/unit compatibility.</p>

<p>@since 3.4.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_all">assert_all</a>
                            </div>
                          </div>

                  <div id="method-i-assert_block" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_block</span><span
                                class="method-args">(message=&quot;assert_block failed.&quot;) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The assertion upon which all other assertions are based. Passes if the block yields not false nor nil.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_block</span> <span class="ruby-string">&quot;Couldn&#39;t do the thing&quot;</span> <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">do_the_thing</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="assert_block-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_block</span>(<span class="ruby-identifier">message</span>=<span class="ruby-string">&quot;assert_block failed.&quot;</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> (<span class="ruby-operator">!</span> <span class="ruby-keyword">yield</span>)
      <span class="ruby-identifier">options</span> = {}
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:user_message</span>)
        <span class="ruby-identifier">options</span>[<span class="ruby-value">:user_message</span>] = <span class="ruby-identifier">message</span>.<span class="ruby-identifier">user_message</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">AssertionFailedError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">options</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_boolean" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_boolean</span><span
                                class="method-args">(actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘actual` is a boolean value.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_boolean</span>(<span class="ruby-keyword">true</span>) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_boolean</span>(<span class="ruby-keyword">nil</span>)  <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_boolean-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1358</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_boolean</span>(<span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                               <span class="ruby-string">&quot;&lt;true&gt; or &lt;false&gt; expected but was\n&lt;?&gt;&quot;</span>,
                               <span class="ruby-identifier">actual</span>)) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">true</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">actual</span> <span class="ruby-operator">||</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">actual</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_compare" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_compare</span><span
                                class="method-args">(expected, operator, actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if expression “‘expected` `operator` `actual`” is not false nor nil.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_compare</span>(<span class="ruby-value">1</span>, <span class="ruby-string">&quot;&lt;&quot;</span>, <span class="ruby-value">10</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_compare</span>(<span class="ruby-value">1</span>, <span class="ruby-string">&quot;&gt;=&quot;</span>, <span class="ruby-value">10</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_compare-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1407</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_compare</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">operator</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-identifier">assert_send</span>([[<span class="ruby-string">&quot;&lt;&quot;</span>, <span class="ruby-string">&quot;&lt;=&quot;</span>, <span class="ruby-string">&quot;&gt;&quot;</span>, <span class="ruby-string">&quot;&gt;=&quot;</span>], <span class="ruby-value">:include?</span>, <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">to_s</span>])
          <span class="ruby-keyword">case</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">to_s</span>
          <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;&lt;&quot;</span>
            <span class="ruby-identifier">operator_description</span> = <span class="ruby-string">&quot;less than&quot;</span>
          <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;&lt;=&quot;</span>
            <span class="ruby-identifier">operator_description</span> = <span class="ruby-string">&quot;less than or equal to&quot;</span>
          <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;&gt;&quot;</span>
            <span class="ruby-identifier">operator_description</span> = <span class="ruby-string">&quot;greater than&quot;</span>
          <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;&gt;=&quot;</span>
            <span class="ruby-identifier">operator_description</span> = <span class="ruby-string">&quot;greater than or equal to&quot;</span>
          <span class="ruby-keyword">end</span>
          <span class="ruby-identifier">template</span> = <span class="ruby-identifier">&lt;&lt;-EOT</span>
<span class="ruby-value">&lt;?&gt; #{operator} &lt;?&gt; should be true
&lt;?&gt; was expected to be #{operator_description}
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">template</span>,
                                       <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>,
                                       <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>)
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-identifier">expected</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">operator</span>, <span class="ruby-identifier">actual</span>)
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_const_defined" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_const_defined</span><span
                                class="method-args">(object, constant_name, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.const_defined?(`constant_name`)</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_const_defined</span>(<span class="ruby-constant">Test</span>, <span class="ruby-value">:Unit</span>)          <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_const_defined</span>(<span class="ruby-constant">Object</span>, <span class="ruby-value">:Nonexistent</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_const_defined-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1502</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_const_defined</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">constant_name</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt;.const_defined\\?(&lt;?&gt;) expected.&quot;</span>,
                                 <span class="ruby-identifier">object</span>, <span class="ruby-identifier">constant_name</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">object</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-identifier">constant_name</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_empty" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_empty</span><span
                                class="method-args">(object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object` is empty.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_empty</span>(<span class="ruby-string">&quot;&quot;</span>)                       <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_empty</span>([])                       <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_empty</span>({})                       <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_empty</span>(<span class="ruby-string">&quot; &quot;</span>)                      <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_empty</span>([<span class="ruby-keyword">nil</span>])                    <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_empty</span>({<span class="ruby-value">1</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">2</span>})                 <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_empty-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1732</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_empty</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">object</span>, <span class="ruby-value">:empty?</span>,
                      <span class="ruby-string">&quot;The object must respond to :empty?.&quot;</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to be empty.&quot;</span>,
                                 <span class="ruby-identifier">object</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">object</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_equal" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_equal</span><span
                                class="method-args">(expected, actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘expected` == `actual`.</p>

<p>Note that the ordering of arguments is important, since a helpful error message is generated when this one fails that tells you the values of expected and actual.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_equal</span> <span class="ruby-string">&#39;MY STRING&#39;</span>, <span class="ruby-string">&#39;my string&#39;</span>.<span class="ruby-identifier">upcase</span>
</pre>

                              <div class="method-source-code" id="assert_equal-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 225</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_equal</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">diff</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">delayed_diff</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">expected</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:encoding</span>) <span class="ruby-keyword">and</span>
            <span class="ruby-identifier">actual</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:encoding</span>) <span class="ruby-keyword">and</span>
            <span class="ruby-identifier">expected</span>.<span class="ruby-identifier">encoding</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">actual</span>.<span class="ruby-identifier">encoding</span>
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;EOT</span>
<span class="ruby-value">&lt;?&gt;(?) expected but was
&lt;?&gt;(?).?
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">format</span>,
                                       <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">expected</span>.<span class="ruby-identifier">encoding</span>.<span class="ruby-identifier">name</span>,
                                       <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">actual</span>.<span class="ruby-identifier">encoding</span>.<span class="ruby-identifier">name</span>,
                                       <span class="ruby-identifier">diff</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">&lt;&lt;EOT</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">diff</span>)
<span class="ruby-value">&lt;?&gt; expected but was
&lt;?&gt;.?
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">begin</span>
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-identifier">expected</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">actual</span> }
        <span class="ruby-keyword">rescue</span> <span class="ruby-constant">AssertionFailedError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">failure</span>
          <span class="ruby-identifier">_set_failed_information</span>(<span class="ruby-identifier">failure</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>)
          <span class="ruby-identifier">raise</span> <span class="ruby-identifier">failure</span> <span class="ruby-comment"># For JRuby. :&lt;</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_fail_assertion" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_fail_assertion</span><span
                                class="method-args">(message=nil) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if assertion is failed in block.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_fail_assertion</span> {<span class="ruby-identifier">assert_equal</span>(<span class="ruby-string">&quot;A&quot;</span>, <span class="ruby-string">&quot;B&quot;</span>)}  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_fail_assertion</span> {<span class="ruby-identifier">assert_equal</span>(<span class="ruby-string">&quot;A&quot;</span>, <span class="ruby-string">&quot;A&quot;</span>)}  <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_fail_assertion-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1440</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_fail_assertion</span>(<span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;Failed assertion was expected.&quot;</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-keyword">yield</span>
        <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">AssertionFailedError</span>
        <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_false" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_false</span><span
                                class="method-args">(actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘actual` is false.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_false</span>(<span class="ruby-keyword">false</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_false</span>(<span class="ruby-keyword">nil</span>)    <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_false-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1390</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_false</span>(<span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                               <span class="ruby-string">&quot;&lt;false&gt; expected but was\n&lt;?&gt;&quot;</span>,
                               <span class="ruby-identifier">actual</span>)) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">false</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">actual</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_in_delta" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_in_delta</span><span
                                class="method-args">(expected_float, actual_float, delta=0.001, message=&quot;&quot;)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘expected_float` and `actual_float` are equal within `delta` tolerance.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_in_delta</span> <span class="ruby-value">0.05</span>, (<span class="ruby-value">50000.0</span> <span class="ruby-operator">/</span> <span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-value">6</span>), <span class="ruby-value">0.00001</span>
</pre>

                              <div class="method-source-code" id="assert_in_delta-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 927</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_in_delta</span>(<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">actual_float</span>, <span class="ruby-identifier">delta</span>=<span class="ruby-value">0.001</span>, <span class="ruby-identifier">message</span>=<span class="ruby-string">&quot;&quot;</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">pass</span> = <span class="ruby-identifier">delta</span> <span class="ruby-operator">&gt;=</span> (<span class="ruby-identifier">expected_float</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">actual_float</span>).<span class="ruby-identifier">abs</span>
      <span class="ruby-identifier">assert_operator</span>(<span class="ruby-identifier">delta</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">0.0</span>, <span class="ruby-string">&quot;The delta should not be negative&quot;</span>)
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_delta_message</span>(<span class="ruby-identifier">expected_float</span>,
                                              <span class="ruby-identifier">expected_float</span>,
                                              <span class="ruby-identifier">actual_float</span>,
                                              <span class="ruby-identifier">actual_float</span>,
                                              <span class="ruby-identifier">delta</span>,
                                              <span class="ruby-identifier">delta</span>,
                                              <span class="ruby-identifier">message</span>)
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionFailedError</span>
      <span class="ruby-comment"># for the above assert_operator</span>
      <span class="ruby-identifier">raise</span>
    <span class="ruby-keyword">rescue</span>
      <span class="ruby-identifier">_assert_in_delta_validate_arguments</span>(<span class="ruby-identifier">expected_float</span>,
                                          <span class="ruby-identifier">actual_float</span>,
                                          <span class="ruby-identifier">delta</span>)
      <span class="ruby-identifier">normalized_expected</span> = <span class="ruby-identifier">expected_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_actual</span> = <span class="ruby-identifier">actual_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_delta</span> = <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">pass</span> = (<span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_actual</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">normalized_delta</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_delta_message</span>(<span class="ruby-identifier">expected_float</span>,
                                              <span class="ruby-identifier">normalized_expected</span>,
                                              <span class="ruby-identifier">actual_float</span>,
                                              <span class="ruby-identifier">normalized_actual</span>,
                                              <span class="ruby-identifier">delta</span>,
                                              <span class="ruby-identifier">normalized_delta</span>,
                                              <span class="ruby-identifier">message</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">pass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_in_epsilon" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_in_epsilon</span><span
                                class="method-args">(expected_float, actual_float, epsilon=0.001, message=&quot;&quot;)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘expected_float` and `actual_float` are equal within `epsilon` relative error of `expected_float`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_in_epsilon</span>(<span class="ruby-value">10000.0</span>, <span class="ruby-value">9900.0</span>, <span class="ruby-value">0.1</span>) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_in_epsilon</span>(<span class="ruby-value">10000.0</span>, <span class="ruby-value">9899.0</span>, <span class="ruby-value">0.1</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_in_epsilon-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1089</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_in_epsilon</span>(<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">actual_float</span>, <span class="ruby-identifier">epsilon</span>=<span class="ruby-value">0.001</span>,
                      <span class="ruby-identifier">message</span>=<span class="ruby-string">&quot;&quot;</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">zero_p</span> = <span class="ruby-identifier">expected_float</span>.<span class="ruby-identifier">zero?</span> <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">expected_float</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">zero_p</span>
        <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">epsilon</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">expected_float</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">epsilon</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">abs</span>
      <span class="ruby-identifier">pass</span> = (<span class="ruby-identifier">expected_float</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">actual_float</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">delta</span>
      <span class="ruby-identifier">assert_operator</span>(<span class="ruby-identifier">epsilon</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">0.0</span>, <span class="ruby-string">&quot;The epsilon should not be negative&quot;</span>)
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_epsilon_message</span>(<span class="ruby-identifier">expected_float</span>,
                                                <span class="ruby-identifier">expected_float</span>,
                                                <span class="ruby-identifier">actual_float</span>,
                                                <span class="ruby-identifier">actual_float</span>,
                                                <span class="ruby-identifier">epsilon</span>,
                                                <span class="ruby-identifier">epsilon</span>,
                                                <span class="ruby-identifier">delta</span>,
                                                <span class="ruby-identifier">message</span>)
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionFailedError</span>
      <span class="ruby-comment"># for the above assert_operator</span>
      <span class="ruby-identifier">raise</span>
    <span class="ruby-keyword">rescue</span>
      <span class="ruby-identifier">_assert_in_epsilon_validate_arguments</span>(<span class="ruby-identifier">expected_float</span>,
                                            <span class="ruby-identifier">actual_float</span>,
                                            <span class="ruby-identifier">epsilon</span>)
      <span class="ruby-identifier">normalized_expected</span> = <span class="ruby-identifier">expected_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_actual</span> = <span class="ruby-identifier">actual_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_epsilon</span> = <span class="ruby-identifier">epsilon</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">normalized_expected</span>.<span class="ruby-identifier">zero?</span>
        <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">normalized_epsilon</span> <span class="ruby-operator">**</span> <span class="ruby-value">2</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">normalized_epsilon</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">abs</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_epsilon_message</span>(<span class="ruby-identifier">expected_float</span>,
                                                <span class="ruby-identifier">normalized_expected</span>,
                                                <span class="ruby-identifier">actual_float</span>,
                                                <span class="ruby-identifier">normalized_actual</span>,
                                                <span class="ruby-identifier">epsilon</span>,
                                                <span class="ruby-identifier">normalized_epsilon</span>,
                                                <span class="ruby-identifier">delta</span>,
                                                <span class="ruby-identifier">message</span>)
      <span class="ruby-identifier">pass</span> = (<span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_actual</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">delta</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">pass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_include" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_include</span><span
                                class="method-args">(collection, object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘collection` includes `object`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_include</span>([<span class="ruby-value">1</span>, <span class="ruby-value">10</span>], <span class="ruby-value">1</span>)            <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_include</span>(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>, <span class="ruby-value">5</span>)              <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_include</span>([<span class="ruby-value">1</span>, <span class="ruby-value">10</span>], <span class="ruby-value">5</span>)            <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_include</span>(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>, <span class="ruby-value">20</span>)             <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_include-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1671</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_include</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-value">:include?</span>,
                      <span class="ruby-string">&quot;The collection must respond to :include?.&quot;</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to include\n&lt;?&gt;.&quot;</span>,
                                 <span class="ruby-identifier">collection</span>,
                                 <span class="ruby-identifier">object</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">object</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-assert_includes">assert_includes</a>
                            </div>

                          </div>

                  <div id="method-i-assert_includes" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">assert_includes</span><span
                                class="method-args">(collection, object, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_include">assert_include</a>
                            </div>
                          </div>

                  <div id="method-i-assert_instance_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_instance_of</span><span
                                class="method-args">(klass, object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.instance_of?(`klass`). When `klass` is an array of classes, it passes if any class satisfies +object.instance_of?(class).</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_instance_of</span>(<span class="ruby-constant">String</span>, <span class="ruby-string">&#39;foo&#39;</span>)            <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_instance_of</span>([<span class="ruby-constant">Fixnum</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-value">100</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_instance_of</span>([<span class="ruby-constant">Numeric</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-value">100</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_instance_of-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 391</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_instance_of</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
            <span class="ruby-identifier">klasses</span> = <span class="ruby-identifier">klass</span>
          <span class="ruby-keyword">else</span>
            <span class="ruby-identifier">klasses</span> = [<span class="ruby-identifier">klass</span>]
          <span class="ruby-keyword">end</span>
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-string">&quot;The first parameter to assert_instance_of should be &quot;</span> <span class="ruby-operator">+</span>
                       <span class="ruby-string">&quot;a Class or an Array of Class.&quot;</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>)}
          <span class="ruby-keyword">end</span>
          <span class="ruby-identifier">klass_message</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">maybe_container</span>(<span class="ruby-identifier">klass</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
            <span class="ruby-node">&quot;&lt;#{value}&gt;&quot;</span>
          <span class="ruby-keyword">end</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">&lt;&lt;EOT</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">klass_message</span>, <span class="ruby-identifier">object</span>.<span class="ruby-identifier">class</span>)
<span class="ruby-value">&lt;?&gt; was expected to be instance_of\\?
? but was
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-identifier">k</span>)}
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_kind_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_kind_of</span><span
                                class="method-args">(klass, object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.kind_of?(`klass`). When `klass` is an array of classes or modules, it passes if any class or module satisfies +object.kind_of?(class_or_module).</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_kind_of</span>(<span class="ruby-constant">Object</span>, <span class="ruby-string">&#39;foo&#39;</span>)                <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_kind_of</span>([<span class="ruby-constant">Fixnum</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-value">100</span>)      <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_kind_of</span>([<span class="ruby-constant">Fixnum</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-string">&quot;string&quot;</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_kind_of-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 478</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_kind_of</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
      <span class="ruby-identifier">klasses</span> = <span class="ruby-identifier">klass</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">klasses</span> = [<span class="ruby-identifier">klass</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-string">&quot;The first parameter to assert_kind_of should be &quot;</span> <span class="ruby-operator">+</span>
                 <span class="ruby-string">&quot;a kind_of Module or an Array of a kind_of Module.&quot;</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Module</span>)}
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">klass_message</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">maybe_container</span>(<span class="ruby-identifier">klass</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
      <span class="ruby-node">&quot;&lt;#{value}&gt;&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to be kind_of\\?\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;? but was\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;&lt;?&gt;.&quot;</span>,
                                 <span class="ruby-identifier">object</span>,
                                 <span class="ruby-identifier">klass_message</span>,
                                 <span class="ruby-identifier">object</span>.<span class="ruby-identifier">class</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-identifier">k</span>)}
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_match" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_match</span><span
                                class="method-args">(pattern, string, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘pattern` =~ `string`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_match</span>(<span class="ruby-regexp">/\d+/</span>, <span class="ruby-string">&#39;five, 6, seven&#39;</span>)
</pre>

                              <div class="method-source-code" id="assert_match-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 601</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_match</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">string</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">pattern</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">pattern</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to be =~\n&lt;?&gt;.&quot;</span>,
                                 <span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">string</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-identifier">pattern</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">string</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_nil" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_nil</span><span
                                class="method-args">(object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.nil?.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_nil</span> [<span class="ruby-value">1</span>, <span class="ruby-value">2</span>].<span class="ruby-identifier">uniq!</span>
</pre>

                              <div class="method-source-code" id="assert_nil-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 462</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_nil</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">&lt;&lt;EOT</span>, <span class="ruby-identifier">object</span>)
<span class="ruby-value">&lt;?&gt; was expected to be nil.
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-identifier">object</span>.<span class="ruby-identifier">nil?</span> }
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_no_match" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_no_match</span><span
                                class="method-args">(regexp, string, message=&quot;&quot;)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@deprecated Use {#assert_not_match} instead.</p>

<p>Passes if ‘regexp` !~ `string`</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_no_match</span>(<span class="ruby-regexp">/two/</span>, <span class="ruby-string">&#39;one 2 three&#39;</span>)   <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_no_match</span>(<span class="ruby-regexp">/three/</span>, <span class="ruby-string">&#39;one 2 three&#39;</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_no_match-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 798</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_no_match</span>(<span class="ruby-identifier">regexp</span>, <span class="ruby-identifier">string</span>, <span class="ruby-identifier">message</span>=<span class="ruby-string">&quot;&quot;</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_instance_of</span>(<span class="ruby-constant">Regexp</span>, <span class="ruby-identifier">regexp</span>,
                       <span class="ruby-string">&quot;The first argument to assert_no_match &quot;</span> <span class="ruby-operator">+</span>
                       <span class="ruby-string">&quot;should be a Regexp.&quot;</span>)
    <span class="ruby-identifier">assert_not_match</span>(<span class="ruby-identifier">regexp</span>, <span class="ruby-identifier">string</span>, <span class="ruby-identifier">message</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_not_const_defined" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_const_defined</span><span
                                class="method-args">(object, constant_name, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if !‘object`.const_defined?(`constant_name`)</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_const_defined</span>(<span class="ruby-constant">Object</span>, <span class="ruby-value">:Nonexistent</span>) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_const_defined</span>(<span class="ruby-constant">Test</span>, <span class="ruby-value">:Unit</span>)          <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_not_const_defined-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1519</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_const_defined</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">constant_name</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;!&lt;?&gt;.const_defined\\?(&lt;?&gt;) expected.&quot;</span>,
                                 <span class="ruby-identifier">object</span>, <span class="ruby-identifier">constant_name</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-operator">!</span><span class="ruby-identifier">object</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-identifier">constant_name</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_not_empty" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_empty</span><span
                                class="method-args">(object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object` is not empty.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_empty</span>(<span class="ruby-string">&quot; &quot;</span>)                      <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_empty</span>([<span class="ruby-keyword">nil</span>])                    <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_empty</span>({<span class="ruby-value">1</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">2</span>})                 <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_empty</span>(<span class="ruby-string">&quot;&quot;</span>)                       <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_not_empty</span>([])                       <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_not_empty</span>({})                       <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_not_empty-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1755</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_empty</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">object</span>, <span class="ruby-value">:empty?</span>,
                      <span class="ruby-string">&quot;The object must respond to :empty?.&quot;</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to not be empty.&quot;</span>,
                                 <span class="ruby-identifier">object</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">not</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_empty">refute_empty</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_equal" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_equal</span><span
                                class="method-args">(expected, actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘expected` != `actual`</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_equal</span> <span class="ruby-string">&#39;some string&#39;</span>, <span class="ruby-value">5</span>
</pre>

                              <div class="method-source-code" id="assert_not_equal-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 740</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_equal</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                               <span class="ruby-string">&quot;&lt;?&gt; was expected to be != to\n&lt;?&gt;.&quot;</span>,
                               <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>)
  <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-identifier">expected</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">actual</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_equal">refute_equal</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_in_delta" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_in_delta</span><span
                                class="method-args">(expected_float, actual_float, delta=0.001, message=&quot;&quot;)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘expected_float` and `actual_float` are not equal within `delta` tolerance.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_in_delta</span>(<span class="ruby-value">0.05</span>, (<span class="ruby-value">50000.0</span> <span class="ruby-operator">/</span> <span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-value">6</span>), <span class="ruby-value">0.00002</span>) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_in_delta</span>(<span class="ruby-value">0.05</span>, (<span class="ruby-value">50000.0</span> <span class="ruby-operator">/</span> <span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-value">6</span>), <span class="ruby-value">0.00001</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_not_in_delta-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 971</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_in_delta</span>(<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">actual_float</span>, <span class="ruby-identifier">delta</span>=<span class="ruby-value">0.001</span>, <span class="ruby-identifier">message</span>=<span class="ruby-string">&quot;&quot;</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">_assert_in_delta_validate_arguments</span>(<span class="ruby-identifier">expected_float</span>,
                                        <span class="ruby-identifier">actual_float</span>,
                                        <span class="ruby-identifier">delta</span>)
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">pass</span> = (<span class="ruby-identifier">expected_float</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">actual_float</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">delta</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_delta_message</span>(<span class="ruby-identifier">expected_float</span>,
                                              <span class="ruby-identifier">expected_float</span>,
                                              <span class="ruby-identifier">actual_float</span>,
                                              <span class="ruby-identifier">actual_float</span>,
                                              <span class="ruby-identifier">delta</span>,
                                              <span class="ruby-identifier">delta</span>,
                                              <span class="ruby-identifier">message</span>,
                                              <span class="ruby-value">:negative_assertion</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>)
    <span class="ruby-keyword">rescue</span>
      <span class="ruby-identifier">normalized_expected</span> = <span class="ruby-identifier">expected_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_actual</span> = <span class="ruby-identifier">actual_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_delta</span> = <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">pass</span> = (<span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_actual</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">normalized_delta</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_delta_message</span>(<span class="ruby-identifier">expected_float</span>,
                                              <span class="ruby-identifier">normalized_expected</span>,
                                              <span class="ruby-identifier">actual_float</span>,
                                              <span class="ruby-identifier">normalized_actual</span>,
                                              <span class="ruby-identifier">delta</span>,
                                              <span class="ruby-identifier">normalized_delta</span>,
                                              <span class="ruby-identifier">message</span>,
                                              <span class="ruby-value">:negative_assertion</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">pass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_in_delta">refute_in_delta</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_in_epsilon" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_in_epsilon</span><span
                                class="method-args">(expected_float, actual_float, epsilon=0.001, message=&quot;&quot;)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘expected_float` and `actual_float` are not equal within `epsilon` relative error of `expected_float`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_in_epsilon</span>(<span class="ruby-value">10000.0</span>, <span class="ruby-value">9900.0</span>, <span class="ruby-value">0.1</span>) <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_not_in_epsilon</span>(<span class="ruby-value">10000.0</span>, <span class="ruby-value">9899.0</span>, <span class="ruby-value">0.1</span>) <span class="ruby-comment"># -&gt; pass</span>
</pre>

                              <div class="method-source-code" id="assert_not_in_epsilon-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1150</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_in_epsilon</span>(<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">actual_float</span>, <span class="ruby-identifier">epsilon</span>=<span class="ruby-value">0.001</span>,
                          <span class="ruby-identifier">message</span>=<span class="ruby-string">&quot;&quot;</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">expected_float</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">epsilon</span>
      <span class="ruby-identifier">pass</span> = (<span class="ruby-identifier">expected_float</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">actual_float</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">delta</span>
      <span class="ruby-identifier">assert_operator</span>(<span class="ruby-identifier">epsilon</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">0.0</span>, <span class="ruby-string">&quot;The epsilon should not be negative&quot;</span>)
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_epsilon_message</span>(<span class="ruby-identifier">expected_float</span>,
                                                <span class="ruby-identifier">expected_float</span>,
                                                <span class="ruby-identifier">actual_float</span>,
                                                <span class="ruby-identifier">actual_float</span>,
                                                <span class="ruby-identifier">epsilon</span>,
                                                <span class="ruby-identifier">epsilon</span>,
                                                <span class="ruby-identifier">delta</span>,
                                                <span class="ruby-identifier">message</span>,
                                                <span class="ruby-value">:negative_assertion</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>)
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionFailedError</span>
      <span class="ruby-comment"># for the above assert_operator</span>
      <span class="ruby-identifier">raise</span>
    <span class="ruby-keyword">rescue</span>
      <span class="ruby-identifier">_assert_in_epsilon_validate_arguments</span>(<span class="ruby-identifier">expected_float</span>,
                                            <span class="ruby-identifier">actual_float</span>,
                                            <span class="ruby-identifier">epsilon</span>)
      <span class="ruby-identifier">normalized_expected</span> = <span class="ruby-identifier">expected_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_actual</span> = <span class="ruby-identifier">actual_float</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">normalized_epsilon</span> = <span class="ruby-identifier">epsilon</span>.<span class="ruby-identifier">to_f</span>
      <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">normalized_epsilon</span>
      <span class="ruby-identifier">pass</span> = (<span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_actual</span>).<span class="ruby-identifier">abs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">delta</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">_assert_in_epsilon_message</span>(<span class="ruby-identifier">expected_float</span>,
                                                <span class="ruby-identifier">normalized_expected</span>,
                                                <span class="ruby-identifier">actual_float</span>,
                                                <span class="ruby-identifier">normalized_actual</span>,
                                                <span class="ruby-identifier">epsilon</span>,
                                                <span class="ruby-identifier">normalized_epsilon</span>,
                                                <span class="ruby-identifier">delta</span>,
                                                <span class="ruby-identifier">message</span>,
                                                <span class="ruby-value">:negative_assertion</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">pass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_in_epsilon">refute_in_epsilon</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_include" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_include</span><span
                                class="method-args">(collection, object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘collection` doesn’t include ‘object`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_include</span>([<span class="ruby-value">1</span>, <span class="ruby-value">10</span>], <span class="ruby-value">5</span>)            <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_include</span>(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>, <span class="ruby-value">20</span>)             <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_include</span>([<span class="ruby-value">1</span>, <span class="ruby-value">10</span>], <span class="ruby-value">1</span>)            <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_not_include</span>(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>, <span class="ruby-value">5</span>)              <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_not_include-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1698</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_include</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-value">:include?</span>,
                      <span class="ruby-string">&quot;The collection must respond to :include?.&quot;</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to not include\n&lt;?&gt;.&quot;</span>,
                                 <span class="ruby-identifier">collection</span>,
                                 <span class="ruby-identifier">object</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">not</span> <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">object</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-assert_not_includes">assert_not_includes</a>, <a href="Assertions.html#method-i-refute_includes">refute_includes</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_includes" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">assert_not_includes</span><span
                                class="method-args">(collection, object, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_include">assert_not_include</a>
                            </div>
                          </div>

                  <div id="method-i-assert_not_instance_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_instance_of</span><span
                                class="method-args">(klass, object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.instance_of?(`klass`) does not hold. When `klass` is an array of classes, it passes if no class satisfies +object.instance_of?(class).</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_instance_of</span>(<span class="ruby-constant">String</span>, <span class="ruby-value">100</span>)                <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_instance_of</span>([<span class="ruby-constant">Fixnum</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-string">&#39;100&#39;</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_instance_of</span>([<span class="ruby-constant">Numeric</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-value">100</span>)   <span class="ruby-comment"># -&gt; fail</span>
</pre>

<p>@since 3.0.0</p>

                              <div class="method-source-code" id="assert_not_instance_of-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 427</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_instance_of</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
      <span class="ruby-identifier">klasses</span> = <span class="ruby-identifier">klass</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">klasses</span> = [<span class="ruby-identifier">klass</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-string">&quot;The first parameter to assert_not_instance_of should be &quot;</span> <span class="ruby-operator">+</span>
                 <span class="ruby-string">&quot;a Class or an Array of Class.&quot;</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>)}
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">klass_message</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">maybe_container</span>(<span class="ruby-identifier">klass</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
      <span class="ruby-node">&quot;&lt;#{value}&gt;&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to not be instance_of\\?\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;? but was.&quot;</span>,
                                 <span class="ruby-identifier">object</span>,
                                 <span class="ruby-identifier">klass_message</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">none?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-identifier">k</span>)}
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_instance_of">refute_instance_of</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_kind_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_kind_of</span><span
                                class="method-args">(klass, object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.kind_of?(`klass`) does not hold. When `klass` is an array of classes or modules, it passes only if all classes (and modules) do not satisfy +object.kind_of?(class_or_module).</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_kind_of</span>(<span class="ruby-constant">Fixnum</span>, <span class="ruby-string">&#39;foo&#39;</span>)           <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_kind_of</span>([<span class="ruby-constant">Fixnum</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-string">&#39;0&#39;</span>) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_kind_of</span>([<span class="ruby-constant">Fixnum</span>, <span class="ruby-constant">NilClass</span>], <span class="ruby-value">100</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

<p>@since 3.0.0</p>

                              <div class="method-source-code" id="assert_not_kind_of-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 516</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_kind_of</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
      <span class="ruby-identifier">klasses</span> = <span class="ruby-identifier">klass</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">klasses</span> = [<span class="ruby-identifier">klass</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-string">&quot;The first parameter to assert_not_kind_of should be &quot;</span> <span class="ruby-operator">+</span>
                 <span class="ruby-string">&quot;a kind_of Module or an Array of a kind_of Module.&quot;</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Module</span>)}
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">klass_message</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">maybe_container</span>(<span class="ruby-identifier">klass</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
      <span class="ruby-node">&quot;&lt;#{value}&gt;&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to not be kind_of\\?\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;? but was.&quot;</span>,
                                 <span class="ruby-identifier">object</span>,
                                 <span class="ruby-identifier">klass_message</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">klasses</span>.<span class="ruby-identifier">none?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-identifier">k</span>)}
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_kind_of">refute_kind_of</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_match" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_match</span><span
                                class="method-args">(pattern, string, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘regexp` !~ `string`</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_match</span>(<span class="ruby-regexp">/two/</span>, <span class="ruby-string">&#39;one 2 three&#39;</span>)   <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_match</span>(<span class="ruby-regexp">/three/</span>, <span class="ruby-string">&#39;one 2 three&#39;</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_not_match-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 775</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_match</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">string</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">pattern</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">pattern</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; was expected to not match\n&lt;?&gt;.&quot;</span>,
                                 <span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">string</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-identifier">pattern</span> <span class="ruby-operator">!~</span> <span class="ruby-identifier">string</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_match">refute_match</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_nil" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_nil</span><span
                                class="method-args">(object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ! ‘object` .nil?</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_nil</span> <span class="ruby-string">&#39;1 two 3&#39;</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/two/</span>, <span class="ruby-string">&#39;2&#39;</span>)
</pre>

                              <div class="method-source-code" id="assert_not_nil-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 757</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_nil</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                               <span class="ruby-string">&quot;&lt;?&gt; was expected to not be nil.&quot;</span>,
                               <span class="ruby-identifier">object</span>)
  <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>){<span class="ruby-operator">!</span><span class="ruby-identifier">object</span>.<span class="ruby-identifier">nil?</span>}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_nil">refute_nil</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_operator" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_operator</span><span
                                class="method-args">(object1, operator, object2, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Compares the ‘object1` with `object2` using `operator`.</p>

<p>Passes if object1.__send__(operator, object2) is false or nil.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_operator</span>(<span class="ruby-value">5</span>, <span class="ruby-value">:&lt;</span>, <span class="ruby-value">4</span>) <span class="ruby-comment"># =&gt; pass</span>
<span class="ruby-identifier">assert_not_operator</span>(<span class="ruby-value">5</span>, <span class="ruby-value">:&gt;</span>, <span class="ruby-value">4</span>) <span class="ruby-comment"># =&gt; fail</span>
</pre>

<p>@since 3.0.0</p>

                              <div class="method-source-code" id="assert_not_operator-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 658</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_operator</span>(<span class="ruby-identifier">object1</span>, <span class="ruby-identifier">operator</span>, <span class="ruby-identifier">object2</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-string">&quot;&lt;?&gt;\ngiven as the operator for #assert_not_operator must be a Symbol or #respond_to\\?(:to_str).&quot;</span>, <span class="ruby-identifier">operator</span>)
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>){<span class="ruby-identifier">operator</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_str</span>)}
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">&lt;&lt;EOT</span>, <span class="ruby-identifier">object1</span>, <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">literal</span>(<span class="ruby-identifier">operator</span>), <span class="ruby-identifier">object2</span>)
<span class="ruby-value">&lt;?&gt; was expected to not be
?
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-operator">!</span> <span class="ruby-identifier">object1</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">operator</span>, <span class="ruby-identifier">object2</span>) }
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_operator">refute_operator</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_predicate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_predicate</span><span
                                class="method-args">(object, predicate, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.`predicate` is false or nil.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_predicate</span>([<span class="ruby-value">1</span>], <span class="ruby-value">:empty?</span>) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_predicate</span>([], <span class="ruby-value">:empty?</span>)  <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_not_predicate-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1558</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_predicate</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">message</span>)
    <span class="ruby-identifier">actual</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">predicate</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt;.? is false value expected but was\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;&lt;?&gt;&quot;</span>,
                                 <span class="ruby-identifier">object</span>,
                                 <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">literal</span>(<span class="ruby-identifier">predicate</span>),
                                 <span class="ruby-identifier">actual</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">not</span> <span class="ruby-identifier">actual</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_predicate">refute_predicate</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_respond_to" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_respond_to</span><span
                                class="method-args">(object, method, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object` does not .respond_to? `method`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_respond_to</span>(<span class="ruby-string">&#39;bugbear&#39;</span>, <span class="ruby-value">:nonexistence</span>) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_not_respond_to</span>(<span class="ruby-string">&#39;bugbear&#39;</span>, <span class="ruby-value">:size</span>)         <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_not_respond_to-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 574</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_respond_to</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt;.kind_of\\?(Symbol) or\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;&lt;?&gt;.respond_to\\?(:to_str) expected&quot;</span>,
                                 <span class="ruby-identifier">method</span>, <span class="ruby-identifier">method</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">method</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-keyword">or</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_str</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;!&lt;?&gt;.respond_to\\?(?) expected\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;(Class: &lt;?&gt;)&quot;</span>,
                                 <span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">object</span>.<span class="ruby-identifier">class</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) {<span class="ruby-operator">!</span><span class="ruby-identifier">object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method</span>)}
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_respond_to">refute_respond_to</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_same" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_same</span><span
                                class="method-args">(expected, actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ! ‘actual` .equal? `expected`</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_same</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>, <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
</pre>

                              <div class="method-source-code" id="assert_not_same-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 720</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_same</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">&lt;&lt;EOT</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">expected</span>.<span class="ruby-identifier">__id__</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">actual</span>.<span class="ruby-identifier">__id__</span>)
<span class="ruby-value">&lt;?&gt;
with id &lt;?&gt; was expected to not be equal\\? to
&lt;?&gt;
with id &lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-operator">!</span><span class="ruby-identifier">actual</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">expected</span>) }
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-refute_same">refute_same</a>
                            </div>

                          </div>

                  <div id="method-i-assert_not_send" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_not_send</span><span
                                class="method-args">(send_array, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if the method ‘__send__` returns false or nil.</p>

<p>‘send_array` is composed of:</p>
<ul><li>
<p>A receiver</p>
</li><li>
<p>A method</p>
</li><li>
<p>Arguments to the method</p>
</li></ul>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_not_send</span>([[<span class="ruby-value">1</span>, <span class="ruby-value">2</span>], <span class="ruby-value">:member?</span>, <span class="ruby-value">1</span>]) <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_not_send</span>([[<span class="ruby-value">1</span>, <span class="ruby-value">2</span>], <span class="ruby-value">:member?</span>, <span class="ruby-value">4</span>]) <span class="ruby-comment"># -&gt; pass</span>
</pre>

                              <div class="method-source-code" id="assert_not_send-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1323</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_not_send</span>(<span class="ruby-identifier">send_array</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-identifier">assert_instance_of</span>(<span class="ruby-constant">Array</span>, <span class="ruby-identifier">send_array</span>,
                             <span class="ruby-string">&quot;assert_not_send requires an array &quot;</span> <span class="ruby-operator">+</span>
                             <span class="ruby-string">&quot;of send information&quot;</span>)
          <span class="ruby-identifier">assert_operator</span>(<span class="ruby-identifier">send_array</span>.<span class="ruby-identifier">size</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">2</span>,
                          <span class="ruby-string">&quot;assert_not_send requires at least a receiver &quot;</span> <span class="ruby-operator">+</span>
                          <span class="ruby-string">&quot;and a message name&quot;</span>)
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;EOT</span>
<span class="ruby-value">&lt;?&gt; was expected to respond to
&lt;?(*?)&gt; with not a true value but was
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">receiver</span>, <span class="ruby-identifier">message_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span> = <span class="ruby-identifier">send_array</span>
          <span class="ruby-identifier">result</span> = <span class="ruby-keyword">nil</span>
          <span class="ruby-identifier">full_message</span> =
            <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                          <span class="ruby-identifier">format</span>,
                          <span class="ruby-identifier">receiver</span>,
                          <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">literal</span>(<span class="ruby-identifier">message_name</span>.<span class="ruby-identifier">to_s</span>),
                          <span class="ruby-identifier">arguments</span>,
                          <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">delayed_literal</span> {<span class="ruby-identifier">result</span>})
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-identifier">result</span> = <span class="ruby-identifier">receiver</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">message_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>)
            <span class="ruby-keyword">not</span> <span class="ruby-identifier">result</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_nothing_leaked_memory" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_nothing_leaked_memory</span><span
                                class="method-args">(max_increasable_size, target=:physical, message=nil) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@overload <a href="Assertions.html#method-i-assert_nothing_leaked_memory"><code>assert_nothing_leaked_memory</code></a>(max_increasable_size, target=:physical, message=nil, &amp;block)</p>

<pre>Asserts that increased memory usage by `block.call` is less
than `max_increasable_size`. `GC.start` is called before and
after `block.call`.

This assertion may be fragile. Because memory usage is
depends on the current Ruby process&#39;s memory
usage. Launching a new Ruby process for this will produce
more stable result but we need to specify target code as
`String` instead of block for the approach. We choose easy
to write API approach rather than more stable result
approach for this case.

@example Pass pattern
  require &quot;objspace&quot;
  size_per_object = ObjectSpace.memsize_of(&quot;Hello&quot;)
  # If memory isn&#39;t leaked, physical memory of almost created objects
  # (1000 - 10 objects) must be freed.
  assert_nothing_leaked_memory(size_per_object * 10) do
    1_000.times do
      &quot;Hello&quot;.dup
    end
  end # =&gt; pass

@example Failure pattern
  require &quot;objspace&quot;
  size_per_object = ObjectSpace.memsize_of(&quot;Hello&quot;)
  strings = []
  assert_nothing_leaked_memory(size_per_object * 10) do
    10_000.times do
      # Created objects aren&#39;t GC-ed because they are referred.
      strings &lt;&lt; &quot;Hello&quot;.dup
    end
  end # =&gt; failure

@param target [:physical, :virtual] which memory usage is
  used for comparing. `:physical` means physical memory usage
  also known as Resident Set Size (RSS). `:virtual` means
  virtual memory usage.
@yield [] do anything you want to measure memory usage
  in the block.
@yieldreturn [void]
@return [void]</pre>

<p>@since 3.4.5</p>

                              <div class="method-source-code" id="assert_nothing_leaked_memory-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1871</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_nothing_leaked_memory</span>(<span class="ruby-identifier">max_increasable_size</span>,
                                       <span class="ruby-identifier">target</span>=<span class="ruby-value">:physical</span>,
                                       <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span>
          <span class="ruby-identifier">before</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryUsage</span>.<span class="ruby-identifier">new</span>
          <span class="ruby-keyword">unless</span> <span class="ruby-identifier">before</span>.<span class="ruby-identifier">collected?</span>
            <span class="ruby-identifier">omit</span>(<span class="ruby-string">&quot;memory usage collection isn&#39;t supported on this platform&quot;</span>)
          <span class="ruby-keyword">end</span>
          <span class="ruby-keyword">yield</span>
          <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span>
          <span class="ruby-identifier">after</span> = <span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">MemoryUsage</span>.<span class="ruby-identifier">new</span>
          <span class="ruby-identifier">before_value</span> = <span class="ruby-identifier">before</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">target</span>)
          <span class="ruby-identifier">after_value</span> = <span class="ruby-identifier">after</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">target</span>)
          <span class="ruby-identifier">actual_increased_size</span> = <span class="ruby-identifier">after_value</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">before_value</span>
          <span class="ruby-identifier">template</span> = <span class="ruby-identifier">&lt;&lt;-TEMPLATE</span>
<span class="ruby-value">&lt;?&gt; was expected to be less than
&lt;?&gt;.
</span><span class="ruby-identifier">          TEMPLATE</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                       <span class="ruby-identifier">template</span>,
                                       <span class="ruby-identifier">actual_increased_size</span>,
                                       <span class="ruby-identifier">max_increasable_size</span>)
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-identifier">actual_increased_size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">max_increasable_size</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_nothing_raised" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_nothing_raised</span><span
                                class="method-args">(*args) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if block does not raise an exception.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_nothing_raised</span> <span class="ruby-keyword">do</span>
  [<span class="ruby-value">1</span>, <span class="ruby-value">2</span>].<span class="ruby-identifier">uniq</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="assert_nothing_raised-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 683</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_nothing_raised</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
      <span class="ruby-identifier">message</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">message</span> = <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">assert_exception_helper</span> = <span class="ruby-constant">AssertExceptionHelper</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">args</span>)
    <span class="ruby-keyword">begin</span>
      <span class="ruby-keyword">yield</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
      <span class="ruby-keyword">if</span> ((<span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">e</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">AssertionFailedError</span>)) <span class="ruby-operator">||</span>
          <span class="ruby-identifier">assert_exception_helper</span>.<span class="ruby-identifier">expected?</span>(<span class="ruby-identifier">e</span>))
        <span class="ruby-identifier">failure_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-string">&quot;Exception raised:\n?&quot;</span>, <span class="ruby-identifier">e</span>)
        <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">failure_message</span>) {<span class="ruby-keyword">false</span>}
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">raise</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_nothing_thrown" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_nothing_thrown</span><span
                                class="method-args">(message=nil, &amp;proc)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if block does not throw anything.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_nothing_thrown</span> <span class="ruby-keyword">do</span>
  [<span class="ruby-value">1</span>, <span class="ruby-value">2</span>].<span class="ruby-identifier">uniq</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="assert_nothing_thrown-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 903</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_nothing_thrown</span>(<span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert</span>(<span class="ruby-identifier">block_given?</span>, <span class="ruby-string">&quot;Should have passed a block to assert_nothing_thrown&quot;</span>)
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">error</span>
      <span class="ruby-identifier">extractor</span> = <span class="ruby-constant">ThrowTagExtractor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">error</span>)
      <span class="ruby-identifier">tag</span> = <span class="ruby-identifier">extractor</span>.<span class="ruby-identifier">extract_tag</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                   <span class="ruby-string">&quot;&lt;?&gt; was thrown when nothing was expected&quot;</span>,
                                   <span class="ruby-identifier">tag</span>)
      <span class="ruby-identifier">flunk</span>(<span class="ruby-identifier">full_message</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert</span>(<span class="ruby-keyword">true</span>, <span class="ruby-string">&quot;Expected nothing to be thrown&quot;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_operator" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_operator</span><span
                                class="method-args">(object1, operator, object2, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Compares the ‘object1` with `object2` using `operator`.</p>

<p>Passes if object1.__send__(operator, object2) is not false nor nil.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_operator</span> <span class="ruby-value">5</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">4</span>
</pre>

                              <div class="method-source-code" id="assert_operator-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 635</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_operator</span>(<span class="ruby-identifier">object1</span>, <span class="ruby-identifier">operator</span>, <span class="ruby-identifier">object2</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-string">&quot;&lt;?&gt;\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).&quot;</span>, <span class="ruby-identifier">operator</span>)
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>){<span class="ruby-identifier">operator</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_str</span>)}
          <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">&lt;&lt;EOT</span>, <span class="ruby-identifier">object1</span>, <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">literal</span>(<span class="ruby-identifier">operator</span>), <span class="ruby-identifier">object2</span>)
<span class="ruby-value">&lt;?&gt; was expected to be
?
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-identifier">object1</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">operator</span>, <span class="ruby-identifier">object2</span>) }
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_path_exist" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_path_exist</span><span
                                class="method-args">(path, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘path` exists.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_path_exist</span>(<span class="ruby-string">&quot;/tmp&quot;</span>)          <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_path_exist</span>(<span class="ruby-string">&quot;/bin/sh&quot;</span>)       <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_path_exist</span>(<span class="ruby-string">&quot;/nonexistent&quot;</span>)  <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_path_exist-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1634</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_path_exist</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">failure_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                    <span class="ruby-string">&quot;&lt;?&gt; was expected to exist&quot;</span>,
                                    <span class="ruby-identifier">path</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">failure_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_path_not_exist" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_path_not_exist</span><span
                                class="method-args">(path, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘path` doesn’t exist.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_path_not_exist</span>(<span class="ruby-string">&quot;/nonexistent&quot;</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_path_not_exist</span>(<span class="ruby-string">&quot;/tmp&quot;</span>)          <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_path_not_exist</span>(<span class="ruby-string">&quot;/bin/sh&quot;</span>)       <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_path_not_exist-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1652</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_path_not_exist</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">failure_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                    <span class="ruby-string">&quot;&lt;?&gt; was expected to not exist&quot;</span>,
                                    <span class="ruby-identifier">path</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">failure_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">not</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_predicate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_predicate</span><span
                                class="method-args">(object, predicate, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object`.`predicate` is not false nor nil.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_predicate</span>([], <span class="ruby-value">:empty?</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_predicate</span>([<span class="ruby-value">1</span>], <span class="ruby-value">:empty?</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_predicate-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1536</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_predicate</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">predicate</span>, <span class="ruby-identifier">message</span>)
    <span class="ruby-identifier">actual</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">predicate</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt;.? is true value expected but was\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;&lt;?&gt;&quot;</span>,
                                 <span class="ruby-identifier">object</span>,
                                 <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">literal</span>(<span class="ruby-identifier">predicate</span>),
                                 <span class="ruby-identifier">actual</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">actual</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_raise" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_raise</span><span
                                class="method-args">(*args, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if the block raises one of the expected exceptions. When an expected exception is an Exception object, passes if expected_exception == actual_exception.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-constant">LoadError</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&#39;Boom!!!&#39;</span>
<span class="ruby-keyword">end</span> <span class="ruby-comment"># -&gt; pass</span>

<span class="ruby-identifier">assert_raise</span> <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">Exception</span>, <span class="ruby-string">&#39;Any exception should be raised!!!&#39;</span>
<span class="ruby-keyword">end</span> <span class="ruby-comment"># -&gt; pass</span>

<span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;XXX&quot;</span>)) {<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;XXX&quot;</span>} <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">MyError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;XXX&quot;</span>))      {<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;XXX&quot;</span>} <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;ZZZ&quot;</span>)) {<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;XXX&quot;</span>} <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_raise-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 269</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_raise</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">assert_expected_exception</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">_args</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">message</span>, <span class="ruby-identifier">assert_exception_helper</span>, <span class="ruby-identifier">actual_exception</span> = <span class="ruby-identifier">_args</span>
    <span class="ruby-identifier">expected</span> = <span class="ruby-identifier">assert_exception_helper</span>.<span class="ruby-identifier">expected_exceptions</span>
    <span class="ruby-identifier">diff</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">delayed_diff</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual_exception</span>)
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; exception expected but was\n&lt;?&gt;.?&quot;</span>,
                                 <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual_exception</span>, <span class="ruby-identifier">diff</span>)
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">expected</span> <span class="ruby-operator">==</span> [] <span class="ruby-keyword">or</span>
          <span class="ruby-identifier">assert_exception_helper</span>.<span class="ruby-identifier">expected?</span>(<span class="ruby-identifier">actual_exception</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">AssertionFailedError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">failure</span>
      <span class="ruby-identifier">_set_failed_information</span>(<span class="ruby-identifier">failure</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual_exception</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-identifier">failure</span> <span class="ruby-comment"># For JRuby. :&lt;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">_assert_raise</span>(<span class="ruby-identifier">assert_expected_exception</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-assert_raises">assert_raises</a>
                            </div>

                          </div>

                  <div id="method-i-assert_raise_kind_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_raise_kind_of</span><span
                                class="method-args">(*args, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if the block raises one of the given exceptions or sub exceptions of the given exceptions.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_raise_kind_of</span>(<span class="ruby-constant">SystemCallError</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EACCES</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="assert_raise_kind_of-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 366</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_raise_kind_of</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">assert_expected_exception</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">_args</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">message</span>, <span class="ruby-identifier">assert_exception_helper</span>, <span class="ruby-identifier">actual_exception</span> = <span class="ruby-identifier">_args</span>
    <span class="ruby-identifier">expected</span> = <span class="ruby-identifier">assert_exception_helper</span>.<span class="ruby-identifier">expected_exceptions</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; family exception expected &quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;but was\n&lt;?&gt;.&quot;</span>,
                                 <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual_exception</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">assert_exception_helper</span>.<span class="ruby-identifier">expected?</span>(<span class="ruby-identifier">actual_exception</span>, <span class="ruby-value">:kind_of?</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">_assert_raise</span>(<span class="ruby-identifier">assert_expected_exception</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_raise_message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_raise_message</span><span
                                class="method-args">(expected, message=nil) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if an exception is raised in block and its message is ‘expected`.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_raise_message</span>(<span class="ruby-string">&quot;exception&quot;</span>) {<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;exception&quot;</span>}  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_raise_message</span>(<span class="ruby-regexp">/exc/i</span>) {<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;exception&quot;</span>}       <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_raise_message</span>(<span class="ruby-string">&quot;exception&quot;</span>) {<span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;EXCEPTION&quot;</span>}  <span class="ruby-comment"># -&gt; fail</span>
<span class="ruby-identifier">assert_raise_message</span>(<span class="ruby-string">&quot;exception&quot;</span>) {}                   <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_raise_message-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1464</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_raise_message</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; exception message was expected &quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;but none was thrown.&quot;</span>,
                                 <span class="ruby-identifier">expected</span>)
    <span class="ruby-identifier">exception</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-keyword">yield</span>
        <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">exception</span>
        <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">actual</span> = <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>
    <span class="ruby-identifier">diff</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">delayed_diff</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>)
    <span class="ruby-identifier">full_message</span> =
      <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                    <span class="ruby-string">&quot;&lt;?&gt; exception message expected but was\n&quot;</span> <span class="ruby-operator">+</span>
                    <span class="ruby-string">&quot;&lt;?&gt;.?&quot;</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">diff</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">expected</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Regexp</span>)
        <span class="ruby-identifier">expected</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">actual</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">expected</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">actual</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_raise_with_message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_raise_with_message</span><span
                                class="method-args">(expected_exception_class, expected_message, message=nil, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if the block raises ‘expected_exception` with `expected_message`. `expected_message` can be a `String` or `Regexp`.</p>

<p>@example Pass pattern: String</p>

<pre class="ruby"><span class="ruby-identifier">assert_raise_with_message</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-string">&quot;Boom!!!&quot;</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Boom!!!&quot;</span>
<span class="ruby-keyword">end</span> <span class="ruby-comment"># -&gt; pass</span>
</pre>

<p>@example Pass pattern: Regexp</p>

<pre class="ruby"><span class="ruby-identifier">assert_raise_with_message</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-regexp">/!!!/</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Boom!!!&quot;</span>
<span class="ruby-keyword">end</span> <span class="ruby-comment"># -&gt; pass</span>
</pre>

<p>@example <a href="Failure.html"><code>Failure</code></a> pattern: Exception class isn’t matched</p>

<pre class="ruby"><span class="ruby-identifier">assert_raise_with_message</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-string">&quot;Boom!!!&quot;</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;Boom!!!&quot;</span>
<span class="ruby-keyword">end</span> <span class="ruby-comment"># -&gt; failure</span>
</pre>

<p>@example <a href="Failure.html"><code>Failure</code></a> pattern: Exception message isn’t matched</p>

<pre class="ruby"><span class="ruby-identifier">assert_raise_with_message</span>(<span class="ruby-constant">RuntimeError</span>, <span class="ruby-string">&quot;Boom!!!&quot;</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Hello&quot;</span>
<span class="ruby-keyword">end</span> <span class="ruby-comment"># -&gt; failure</span>
</pre>

<p>@since 3.4.3</p>

                              <div class="method-source-code" id="assert_raise_with_message-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 318</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_raise_with_message</span>(<span class="ruby-identifier">expected_exception_class</span>,
                              <span class="ruby-identifier">expected_message</span>,
                              <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>,
                              <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">assert_expected_exception</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">_args</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">_message</span>, <span class="ruby-identifier">assert_exception_helper</span>, <span class="ruby-identifier">actual_exception</span> = <span class="ruby-identifier">_args</span>
    <span class="ruby-identifier">diff</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">delayed_diff</span>([
                                           <span class="ruby-identifier">expected_exception_class</span>,
                                           <span class="ruby-identifier">expected_message</span>,
                                         ],
                                         [
                                           <span class="ruby-identifier">actual_exception</span>.<span class="ruby-identifier">class</span>,
                                           <span class="ruby-identifier">actual_exception</span>.<span class="ruby-identifier">message</span>,
                                         ])
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt;(&lt;?&gt;) exception expected but was\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;&lt;?&gt;(&lt;?&gt;).?&quot;</span>,
                                 <span class="ruby-identifier">expected_exception_class</span>,
                                 <span class="ruby-identifier">expected_message</span>,
                                 <span class="ruby-identifier">actual_exception</span>.<span class="ruby-identifier">class</span>,
                                 <span class="ruby-identifier">actual_exception</span>.<span class="ruby-identifier">message</span>,
                                 <span class="ruby-identifier">diff</span>)
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">assert_exception_helper</span>.<span class="ruby-identifier">expected?</span>(<span class="ruby-identifier">actual_exception</span>) <span class="ruby-keyword">and</span>
          <span class="ruby-identifier">expected_message</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">actual_exception</span>.<span class="ruby-identifier">message</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">AssertionFailedError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">failure</span>
      <span class="ruby-identifier">_set_failed_information</span>(<span class="ruby-identifier">failure</span>,
                              <span class="ruby-identifier">expected_exception_class</span>,
                              <span class="ruby-identifier">actual_exception</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-identifier">failure</span> <span class="ruby-comment"># For JRuby. :&lt;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">actual_exception</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">args</span> = [<span class="ruby-identifier">expected_exception_class</span>]
  <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">message</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">message</span>
  <span class="ruby-identifier">_assert_raise</span>(<span class="ruby-identifier">assert_expected_exception</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_raises" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">assert_raises</span><span
                                class="method-args">(*args, &amp;block)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_raise">assert_raise</a>
                            </div>
                          </div>

                  <div id="method-i-assert_respond_to" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_respond_to</span><span
                                class="method-args">(object, method, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘object` .respond_to? `method`</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_respond_to</span> <span class="ruby-string">&#39;bugbear&#39;</span>, <span class="ruby-value">:slice</span>
</pre>

                              <div class="method-source-code" id="assert_respond_to-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 551</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_respond_to</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt;.kind_of\\?(Symbol) or\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;&lt;?&gt;.respond_to\\?(:to_str) expected&quot;</span>,
                                 <span class="ruby-identifier">method</span>, <span class="ruby-identifier">method</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">method</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-keyword">or</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_str</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt;.respond_to\\?(?) expected\n&quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;(Class: &lt;?&gt;)&quot;</span>,
                                 <span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">object</span>.<span class="ruby-identifier">class</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) {<span class="ruby-identifier">object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method</span>)}
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_same" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_same</span><span
                                class="method-args">(expected, actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘actual` .equal? `expected` (i.e. they are the same instance).</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">o</span> = <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
<span class="ruby-identifier">assert_same</span> <span class="ruby-identifier">o</span>, <span class="ruby-identifier">o</span>
</pre>

                              <div class="method-source-code" id="assert_same-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 618</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_same</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">&lt;&lt;EOT</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">expected</span>.<span class="ruby-identifier">__id__</span>, <span class="ruby-identifier">actual</span>, <span class="ruby-identifier">actual</span>.<span class="ruby-identifier">__id__</span>)
<span class="ruby-value">&lt;?&gt;
with id &lt;?&gt; was expected to be equal\\? to
&lt;?&gt;
with id &lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) { <span class="ruby-identifier">actual</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">expected</span>) }
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_send" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_send</span><span
                                class="method-args">(send_array, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if the method ‘__send__` returns not false nor nil.</p>

<p>‘send_array` is composed of:</p>
<ul><li>
<p>A receiver</p>
</li><li>
<p>A method</p>
</li><li>
<p>Arguments to the method</p>
</li></ul>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_send</span>([[<span class="ruby-value">1</span>, <span class="ruby-value">2</span>], <span class="ruby-value">:member?</span>, <span class="ruby-value">1</span>]) <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_send</span>([[<span class="ruby-value">1</span>, <span class="ruby-value">2</span>], <span class="ruby-value">:member?</span>, <span class="ruby-value">4</span>]) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_send-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1283</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_send</span>(<span class="ruby-identifier">send_array</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
        <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
          <span class="ruby-identifier">assert_instance_of</span>(<span class="ruby-constant">Array</span>, <span class="ruby-identifier">send_array</span>,
                             <span class="ruby-string">&quot;assert_send requires an array &quot;</span> <span class="ruby-operator">+</span>
                             <span class="ruby-string">&quot;of send information&quot;</span>)
          <span class="ruby-identifier">assert_operator</span>(<span class="ruby-identifier">send_array</span>.<span class="ruby-identifier">size</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">2</span>,
                          <span class="ruby-string">&quot;assert_send requires at least a receiver &quot;</span> <span class="ruby-operator">+</span>
                          <span class="ruby-string">&quot;and a message name&quot;</span>)
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;EOT</span>
<span class="ruby-value">&lt;?&gt; was expected to respond to
&lt;?(*?)&gt; with a true value but was
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">receiver</span>, <span class="ruby-identifier">message_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span> = <span class="ruby-identifier">send_array</span>
          <span class="ruby-identifier">result</span> = <span class="ruby-keyword">nil</span>
          <span class="ruby-identifier">full_message</span> =
            <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                          <span class="ruby-identifier">format</span>,
                          <span class="ruby-identifier">receiver</span>,
                          <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">literal</span>(<span class="ruby-identifier">message_name</span>.<span class="ruby-identifier">to_s</span>),
                          <span class="ruby-identifier">arguments</span>,
                          <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">delayed_literal</span> {<span class="ruby-identifier">result</span>})
          <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
            <span class="ruby-identifier">result</span> = <span class="ruby-identifier">receiver</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">message_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>)
            <span class="ruby-identifier">result</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-assert_throw" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_throw</span><span
                                class="method-args">(expected_object, message=nil, &amp;proc)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if the block throws ‘expected_object`</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_throw</span>(<span class="ruby-value">:done</span>) <span class="ruby-keyword">do</span>
  <span class="ruby-identifier">throw</span>(<span class="ruby-value">:done</span>)
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="assert_throw-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 857</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_throw</span>(<span class="ruby-identifier">expected_object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">catch</span>([]) {}
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">TypeError</span>
      <span class="ruby-identifier">assert_instance_of</span>(<span class="ruby-constant">Symbol</span>, <span class="ruby-identifier">expected_object</span>,
                         <span class="ruby-string">&quot;assert_throws expects the symbol that should be thrown for its first argument&quot;</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-string">&quot;Should have passed a block to assert_throw.&quot;</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">caught</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">catch</span>(<span class="ruby-identifier">expected_object</span>) <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">proc</span>.<span class="ruby-identifier">call</span>
        <span class="ruby-identifier">caught</span> = <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                   <span class="ruby-string">&quot;&lt;?&gt; should have been thrown.&quot;</span>,
                                   <span class="ruby-identifier">expected_object</span>)
      <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) {<span class="ruby-identifier">caught</span>}
    <span class="ruby-keyword">rescue</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">error</span>
      <span class="ruby-identifier">extractor</span> = <span class="ruby-constant">ThrowTagExtractor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">error</span>)
      <span class="ruby-identifier">tag</span> = <span class="ruby-identifier">extractor</span>.<span class="ruby-identifier">extract_tag</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                   <span class="ruby-string">&quot;&lt;?&gt; was expected to be thrown but\n&quot;</span> <span class="ruby-operator">+</span>
                                   <span class="ruby-string">&quot;&lt;?&gt; was thrown.&quot;</span>,
                                   <span class="ruby-identifier">expected_object</span>, <span class="ruby-identifier">tag</span>)
      <span class="ruby-identifier">flunk</span>(<span class="ruby-identifier">full_message</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="Assertions.html#method-i-assert_throws">assert_throws</a>
                            </div>

                          </div>

                  <div id="method-i-assert_throws" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">assert_throws</span><span
                                class="method-args">(expected_object, message=nil, &amp;proc)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_throw">assert_throw</a>
                            </div>
                          </div>

                  <div id="method-i-assert_true" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">assert_true</span><span
                                class="method-args">(actual, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Passes if ‘actual` is true.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">assert_true</span>(<span class="ruby-keyword">true</span>)  <span class="ruby-comment"># -&gt; pass</span>
<span class="ruby-identifier">assert_true</span>(<span class="ruby-value">:true</span>) <span class="ruby-comment"># -&gt; fail</span>
</pre>

                              <div class="method-source-code" id="assert_true-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1374</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">assert_true</span>(<span class="ruby-identifier">actual</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                               <span class="ruby-string">&quot;&lt;true&gt; expected but was\n&lt;?&gt;&quot;</span>,
                               <span class="ruby-identifier">actual</span>)) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">true</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">actual</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-build_message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">build_message</span><span
                                class="method-args">(user_message, template=nil, *arguments)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Builds a failure message.  ‘user_message` is added before the `template` and `arguments` replaces the ’?‘s positionally in the template.</p>

                              <div class="method-source-code" id="build_message-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1904</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_message</span>(<span class="ruby-identifier">user_message</span>, <span class="ruby-identifier">template</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>)
  <span class="ruby-identifier">template</span> <span class="ruby-operator">&amp;&amp;=</span> <span class="ruby-identifier">template</span>.<span class="ruby-identifier">chomp</span>
  <span class="ruby-keyword">return</span> <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">user_message</span>, <span class="ruby-identifier">template</span>, <span class="ruby-identifier">arguments</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-flunk" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">flunk</span><span
                                class="method-args">(message=&quot;Flunked&quot;)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Flunk always fails.</p>

<p>@example</p>

<pre class="ruby"><span class="ruby-identifier">flunk</span> <span class="ruby-string">&#39;Not done testing yet.&#39;</span>
</pre>

                              <div class="method-source-code" id="flunk-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 711</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">flunk</span>(<span class="ruby-identifier">message</span>=<span class="ruby-string">&quot;Flunked&quot;</span>)
  <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>)){<span class="ruby-keyword">false</span>}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refute</span><span
                                class="method-args">(object, message=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Asserts that ‘object` is false or nil.</p>

<p>@note Just for minitest compatibility. :&lt;</p>

<p>@param [Object] object The object to be asserted. @return [void]</p>

<p>@example Pass patterns</p>

<pre class="ruby"><span class="ruby-identifier">refute</span>(<span class="ruby-keyword">false</span>)    <span class="ruby-comment"># =&gt; pass</span>
<span class="ruby-identifier">refute</span>(<span class="ruby-keyword">nil</span>)      <span class="ruby-comment"># =&gt; pass</span>
</pre>

<p>@example <a href="Failure.html"><code>Failure</code></a> patterns</p>

<pre class="ruby"><span class="ruby-identifier">refute</span>(<span class="ruby-keyword">true</span>)     <span class="ruby-comment"># =&gt; failure</span>
<span class="ruby-identifier">refute</span>(<span class="ruby-string">&quot;string&quot;</span>) <span class="ruby-comment"># =&gt; failure</span>
</pre>

<p>@since 2.5.3</p>

                              <div class="method-source-code" id="refute-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 191</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refute</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">message</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">assertion_message</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">message</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>, <span class="ruby-constant">String</span>, <span class="ruby-constant">Proc</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">AssertionMessage</span>
      <span class="ruby-identifier">assertion_message</span> = <span class="ruby-identifier">message</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">error_message</span> = <span class="ruby-string">&quot;assertion message must be String, Proc or &quot;</span>
      <span class="ruby-identifier">error_message</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;#{AssertionMessage}: &quot;</span>
      <span class="ruby-identifier">error_message</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;&lt;#{message.inspect}&gt;(&lt;#{message.class}&gt;)&quot;</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-identifier">error_message</span>, <span class="ruby-identifier">filter_backtrace</span>(<span class="ruby-identifier">caller</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-string">&quot;refute should not be called with a block.&quot;</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-operator">!</span><span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assertion_message</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                        <span class="ruby-string">&quot;&lt;?&gt; is neither nil or false.&quot;</span>,
                                        <span class="ruby-identifier">object</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">assertion_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">not</span> <span class="ruby-identifier">object</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-refute_empty" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_empty</span><span
                                class="method-args">(object, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_empty">assert_not_empty</a>
                            </div>
                          </div>

                  <div id="method-i-refute_equal" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_equal</span><span
                                class="method-args">(expected, actual, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_equal">assert_not_equal</a>
                            </div>
                          </div>

                  <div id="method-i-refute_in_delta" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_in_delta</span><span
                                class="method-args">(expected_float, actual_float, delta=0.001, message=&quot;&quot;)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_in_delta">assert_not_in_delta</a>
                            </div>
                          </div>

                  <div id="method-i-refute_in_epsilon" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_in_epsilon</span><span
                                class="method-args">(expected_float, actual_float, epsilon=0.001, message=&quot;&quot;)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_in_epsilon">assert_not_in_epsilon</a>
                            </div>
                          </div>

                  <div id="method-i-refute_includes" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_includes</span><span
                                class="method-args">(collection, object, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_include">assert_not_include</a>
                            </div>
                          </div>

                  <div id="method-i-refute_instance_of" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_instance_of</span><span
                                class="method-args">(klass, object, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_instance_of">assert_not_instance_of</a>
                            </div>
                          </div>

                  <div id="method-i-refute_kind_of" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_kind_of</span><span
                                class="method-args">(klass, object, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_kind_of">assert_not_kind_of</a>
                            </div>
                          </div>

                  <div id="method-i-refute_match" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_match</span><span
                                class="method-args">(pattern, string, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_match">assert_not_match</a>
                            </div>
                          </div>

                  <div id="method-i-refute_nil" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_nil</span><span
                                class="method-args">(object, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_nil">assert_not_nil</a>
                            </div>
                          </div>

                  <div id="method-i-refute_operator" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_operator</span><span
                                class="method-args">(object1, operator, object2, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_operator">assert_not_operator</a>
                            </div>
                          </div>

                  <div id="method-i-refute_predicate" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_predicate</span><span
                                class="method-args">(object, predicate, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 3.0.0</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_predicate">assert_not_predicate</a>
                            </div>
                          </div>

                  <div id="method-i-refute_respond_to" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_respond_to</span><span
                                class="method-args">(object, method, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_respond_to">assert_not_respond_to</a>
                            </div>
                          </div>

                  <div id="method-i-refute_same" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">refute_same</span><span
                                class="method-args">(expected, actual, message=nil)</span>
                            </div>

                            <div class="method-description">
                              <p>Just for minitest compatibility. :&lt;</p>

<p>@since 2.5.3</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="Assertions.html#method-i-assert_not_same">assert_not_same</a>
                            </div>
                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-_assert_in_delta_message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_assert_in_delta_message</span><span
                                class="method-args">(expected_float, normalized_expected, actual_float, normalized_actual, delta, normalized_delta, message, options={})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_assert_in_delta_message-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1028</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_assert_in_delta_message</span>(<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">normalized_expected</span>,
                                   <span class="ruby-identifier">actual_float</span>, <span class="ruby-identifier">normalized_actual</span>,
                                   <span class="ruby-identifier">delta</span>, <span class="ruby-identifier">normalized_delta</span>,
                                   <span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>={})
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:negative_assertion</span>]
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;-EOT</span>
<span class="ruby-value">&lt;?&gt; -/+ &lt;?&gt; was expected to not include
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;-EOT</span>
<span class="ruby-value">&lt;?&gt; -/+ &lt;?&gt; was expected to include
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">arguments</span> = [<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">delta</span>, <span class="ruby-identifier">actual_float</span>]
        <span class="ruby-identifier">relation_format</span> = <span class="ruby-keyword">nil</span>
        <span class="ruby-identifier">relation_arguments</span> = <span class="ruby-keyword">nil</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">normalized_actual</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_delta</span>
          <span class="ruby-identifier">relation_format</span> = <span class="ruby-string">&quot;&lt;&lt;?&gt; &lt; &lt;?&gt;-&lt;?&gt;[?] &lt;= &lt;?&gt;+&lt;?&gt;[?]&gt;&quot;</span>
          <span class="ruby-identifier">relation_arguments</span> = [<span class="ruby-identifier">actual_float</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_delta</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">normalized_delta</span>]
        <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">normalized_actual</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">normalized_delta</span>
          <span class="ruby-identifier">relation_format</span> = <span class="ruby-string">&quot;&lt;&lt;?&gt;-&lt;?&gt;[?] &lt;= &lt;?&gt; &lt;= &lt;?&gt;+&lt;?&gt;[?]&gt;&quot;</span>
          <span class="ruby-identifier">relation_arguments</span> = [<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_delta</span>,
                                <span class="ruby-identifier">actual_float</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">normalized_delta</span>]
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">relation_format</span> = <span class="ruby-string">&quot;&lt;&lt;?&gt;-&lt;?&gt;[?] &lt;= &lt;?&gt;+&lt;?&gt;[?] &lt; &lt;?&gt;&gt;&quot;</span>
          <span class="ruby-identifier">relation_arguments</span> = [<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">normalized_delta</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">normalized_delta</span>,
                                <span class="ruby-identifier">actual_float</span>]
        <span class="ruby-keyword">end</span>

        <span class="ruby-keyword">if</span> <span class="ruby-identifier">relation_format</span>
          <span class="ruby-identifier">format</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">&lt;&lt;-EOT</span>
<span class="ruby-value">
Relation:
#{relation_format}
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">relation_arguments</span>)
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">format</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>)
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_assert_in_delta_validate_arguments" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_assert_in_delta_validate_arguments</span><span
                                class="method-args">(expected_float, actual_float, delta)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_assert_in_delta_validate_arguments-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1012</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_assert_in_delta_validate_arguments</span>(<span class="ruby-identifier">expected_float</span>,
                                        <span class="ruby-identifier">actual_float</span>,
                                        <span class="ruby-identifier">delta</span>)
  {
    <span class="ruby-identifier">expected_float</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;first float&quot;</span>,
    <span class="ruby-identifier">actual_float</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;second float&quot;</span>,
    <span class="ruby-identifier">delta</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;delta&quot;</span>
  }.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">float</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">float</span>, <span class="ruby-value">:to_f</span>,
                      <span class="ruby-string">&quot;The arguments must respond to to_f; &quot;</span> <span class="ruby-operator">+</span>
                      <span class="ruby-node">&quot;the #{name} did not&quot;</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">delta</span> = <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">to_f</span>
  <span class="ruby-identifier">assert_operator</span>(<span class="ruby-identifier">delta</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">0.0</span>, <span class="ruby-string">&quot;The delta should not be negative&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_assert_in_epsilon_message" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_assert_in_epsilon_message</span><span
                                class="method-args">(expected_float, normalized_expected, actual_float, normalized_actual, epsilon, normalized_epsilon, delta, message, options={})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_assert_in_epsilon_message-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1216</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_assert_in_epsilon_message</span>(<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">normalized_expected</span>,
                                     <span class="ruby-identifier">actual_float</span>, <span class="ruby-identifier">normalized_actual</span>,
                                     <span class="ruby-identifier">epsilon</span>, <span class="ruby-identifier">normalized_epsilon</span>,
                                     <span class="ruby-identifier">delta</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>={})
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:negative_assertion</span>]
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;-EOT</span>
<span class="ruby-value">&lt;?&gt; -/+ (&lt;?&gt; * &lt;?&gt;)[?] was expected to not include
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">format</span> = <span class="ruby-identifier">&lt;&lt;-EOT</span>
<span class="ruby-value">&lt;?&gt; -/+ (&lt;?&gt; * &lt;?&gt;)[?] was expected to include
&lt;?&gt;.
</span><span class="ruby-identifier">EOT</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">arguments</span> = [<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">epsilon</span>, <span class="ruby-identifier">delta</span>,
                     <span class="ruby-identifier">actual_float</span>]

        <span class="ruby-identifier">relation_format</span> = <span class="ruby-keyword">nil</span>
        <span class="ruby-identifier">relation_arguments</span> = <span class="ruby-keyword">nil</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">normalized_actual</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">delta</span>
          <span class="ruby-identifier">relation_format</span> = <span class="ruby-string">&quot;&lt;&lt;?&gt; &lt; &lt;?&gt;-(&lt;?&gt;*&lt;?&gt;)[?] &lt;= &lt;?&gt;+(&lt;?&gt;*&lt;?&gt;)[?]&gt;&quot;</span>
          <span class="ruby-identifier">relation_arguments</span> = [<span class="ruby-identifier">actual_float</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">epsilon</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">epsilon</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">delta</span>]
        <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">normalized_actual</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">delta</span>
          <span class="ruby-identifier">relation_format</span> = <span class="ruby-string">&quot;&lt;&lt;?&gt;-(&lt;?&gt;*&lt;?&gt;)[?] &lt;= &lt;?&gt; &lt;= &lt;?&gt;+(&lt;?&gt;*&lt;?&gt;)[?]&gt;&quot;</span>
          <span class="ruby-identifier">relation_arguments</span> = [<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">epsilon</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">actual_float</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">epsilon</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">delta</span>]
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">relation_format</span> = <span class="ruby-string">&quot;&lt;&lt;?&gt;-(&lt;?&gt;*&lt;?&gt;)[?] &lt;= &lt;?&gt;+(&lt;?&gt;*&lt;?&gt;)[?] &lt; &lt;?&gt;&gt;&quot;</span>
          <span class="ruby-identifier">relation_arguments</span> = [<span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">epsilon</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">expected_float</span>, <span class="ruby-identifier">epsilon</span>,
                                <span class="ruby-identifier">normalized_expected</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">delta</span>,
                                <span class="ruby-identifier">actual_float</span>]
        <span class="ruby-keyword">end</span>

        <span class="ruby-keyword">if</span> <span class="ruby-identifier">relation_format</span>
          <span class="ruby-identifier">format</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">&lt;&lt;-EOT</span>
<span class="ruby-value">
Relation:
#{relation_format}
</span><span class="ruby-identifier">EOT</span>
          <span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">relation_arguments</span>)
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">format</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>)
      <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_assert_in_epsilon_validate_arguments" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_assert_in_epsilon_validate_arguments</span><span
                                class="method-args">(expected_float, actual_float, epsilon)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_assert_in_epsilon_validate_arguments-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1200</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_assert_in_epsilon_validate_arguments</span>(<span class="ruby-identifier">expected_float</span>,
                                          <span class="ruby-identifier">actual_float</span>,
                                          <span class="ruby-identifier">epsilon</span>)
  {
    <span class="ruby-identifier">expected_float</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;first float&quot;</span>,
    <span class="ruby-identifier">actual_float</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;second float&quot;</span>,
    <span class="ruby-identifier">epsilon</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;epsilon&quot;</span>
  }.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">float</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">assert_respond_to</span>(<span class="ruby-identifier">float</span>, <span class="ruby-value">:to_f</span>,
                      <span class="ruby-string">&quot;The arguments must respond to to_f; &quot;</span> <span class="ruby-operator">+</span>
                      <span class="ruby-node">&quot;the #{name} did not&quot;</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">epsilon</span> = <span class="ruby-identifier">epsilon</span>.<span class="ruby-identifier">to_f</span>
  <span class="ruby-identifier">assert_operator</span>(<span class="ruby-identifier">epsilon</span>, <span class="ruby-value">:&gt;=</span>, <span class="ruby-value">0.0</span>, <span class="ruby-string">&quot;The epsilon should not be negative&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_assert_raise" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_assert_raise</span><span
                                class="method-args">(assert_expected_exception, *args) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_assert_raise-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1944</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_assert_raise</span>(<span class="ruby-identifier">assert_expected_exception</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">_wrap_assertion</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
      <span class="ruby-identifier">message</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">message</span> = <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">assert_exception_helper</span> = <span class="ruby-constant">AssertExceptionHelper</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">args</span>)
    <span class="ruby-identifier">expected</span> = <span class="ruby-identifier">assert_exception_helper</span>.<span class="ruby-identifier">expected_exceptions</span>
    <span class="ruby-identifier">actual_exception</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">full_message</span> = <span class="ruby-identifier">build_message</span>(<span class="ruby-identifier">message</span>,
                                 <span class="ruby-string">&quot;&lt;?&gt; exception was expected &quot;</span> <span class="ruby-operator">+</span>
                                 <span class="ruby-string">&quot;but none was thrown.&quot;</span>,
                                 <span class="ruby-identifier">expected</span>)
    <span class="ruby-identifier">assert_block</span>(<span class="ruby-identifier">full_message</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-keyword">yield</span>
        <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">actual_exception</span>
        <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">assert_expected_exception</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">assert_exception_helper</span>,
                                   <span class="ruby-identifier">actual_exception</span>)
    <span class="ruby-identifier">actual_exception</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_set_failed_information" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_set_failed_information</span><span
                                class="method-args">(failure, expected, actual)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_set_failed_information-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1973</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_set_failed_information</span>(<span class="ruby-identifier">failure</span>, <span class="ruby-identifier">expected</span>, <span class="ruby-identifier">actual</span>)
  <span class="ruby-identifier">failure</span>.<span class="ruby-identifier">expected</span> = <span class="ruby-identifier">expected</span>
  <span class="ruby-identifier">failure</span>.<span class="ruby-identifier">actual</span> = <span class="ruby-identifier">actual</span>
  <span class="ruby-identifier">failure</span>.<span class="ruby-identifier">inspected_expected</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">convert</span>(<span class="ruby-identifier">expected</span>)
  <span class="ruby-identifier">failure</span>.<span class="ruby-identifier">inspected_actual</span> = <span class="ruby-constant">AssertionMessage</span>.<span class="ruby-identifier">convert</span>(<span class="ruby-identifier">actual</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-_wrap_assertion" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">_wrap_assertion</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="_wrap_assertion-source">
            <pre><span class="ruby-comment"># File test-unit-3.6.1/lib/test/unit/assertions.rb, line 1910</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">_wrap_assertion</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-ivar">@_assertion_wrapped</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@_assertion_wrapped</span>
    <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@_assertion_wrapped</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">add_assertion</span>
      <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-ivar">@_assertion_wrapped</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

